import {LoadFunction, TableColumn} from "@/components/ATable/types";
import ElTablePlus from "@/components/ATable/el-table-plus.vue";
import {ElTablePlusInstance} from "@/components/ATable/data";

export const useTablePlus = (
  load: LoadFunction,
  columns:TableColumn[],
  query?:any,
  autoLoad?:boolean,
  useSelect?:boolean,
  selectType?:'checkbox' | 'radio',
  slot?:Record<string, unknown>
) => {
  const tableRef=ref<ElTablePlusInstance>()
  const r=()=>h(ElTablePlus, {loadFunction:load,columns,query,autoLoad,useSelect,ref:tableRef,selectType},slot)
  return {
    tableRef,
    Table:r
  }
}
